import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int[]arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=scan.nextInt();
        }
        Arrays.sort(arr);
        System.out.println(count(arr,0,0,1));
    }
    public static int count(int[]array,int pos,int sum,int multi){
        int count=0;
        for(int i=pos;i<array.length;i++){
            sum+=array[i];
            multi*=array[i];
            if(sum>multi){
                count=count+1+count(array,i+1,sum,multi);
            }else if(array[i]==1){
                count=count+count(array,i+1,sum,multi);
            }else{
                break;
            }
            sum-=array[i];
            multi/=array[i];
            while(i<array.length-1&&array[i]==array[i+1]){
                i++;
            }
        }
        return count;
    }
}
